package com.app.service.impl;

import com.app.commons.pojo.UserInfo;
import com.app.commons.utils.Page;
import com.app.dao.UserMapper;
import com.app.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired(required = false)
    UserMapper mapper;

    @Override
    public Page<UserInfo> getPage(int pageIndex, int pageSize) {
        int totalCount=mapper.getTotalCount();
        int startIndex=(pageIndex-1)*pageSize;
        List<UserInfo> list = mapper.getUserList(startIndex, pageSize);
        Page<UserInfo> page = new Page<>(pageIndex,pageSize,totalCount,list);
        return page;
    }
}
